<!-- 样式 -->
<style>
    html {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
    }
    .com_header{
        display:none!important;
    }
    .msgs{
        height:40px;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        font-size:16px;
    }
   .github_login{
       width:35px;
       height:35px;
       margin-right:10px;
   }
</style>
<div class="login" id="login">
    <div class="main">
        <div class="center center-ewm">
           <div class="msgs">
                <img v-if="type=='github'?true:false" class="github_login" src="/public/img/github.png">
                <img v-if="type=='weibo'?true:false" class="github_login" src="/public/img/github.png">
                <img v-if="type=='wechat'?true:false" class="github_login" src="/public/img/wechat.png">
               <span>{{title}}</span>
           </div>
        </div>
    </div>
</div>
<script>
    let user_data = '<%- data.data %>';
    if(user_data) user_data = JSON.parse(user_data);
    new Vue({
            el: '#login',
            data: function () {
                return {
                    title:'',
                    type:'github'
                }
            },
            mounted() {
                this.type = user_data.type;
                if(user_data && user_data.desc){
                    this.title = user_data.desc;
                    popup.alert({title: user_data.desc})
                }else if (user_data && user_data.token) {
                    util.setStorage('local', 'userMsg', JSON.stringify(user_data))
                    window.close();
                    window.opener.location.href = "/"
                } else {
                    if(this.type == 'github'){
                        this.title = 'github权限验证失败, 请重试！'
                    }else if(this.type == 'weibo'){
                        this.title = '新浪微博权限验证失败，请重试!'
                    }else if(this.type == 'wechat'){
                        this.title = '微信登录权限验证失败，请重试!'
                    }
                }
            },
        })
</script>